import React, { Component } from 'react'
// 导入路由组件
import {NavLink} from 'react-router-dom'

export default class Hello extends Component {
  changePage(url) {
    // console.log(this.props.history);
    this.props.history.push(url)
  }
  render() {
    return (
      <>
        <div>Hello</div>
        <NavLink to="/com1">com1</NavLink>
        <NavLink to="/com2">com2</NavLink>
        <hr></hr>
        <button onClick={()=>this.changePage('/hello')}>1btn-hello</button>
        <button onClick={()=>this.changePage('/com1')}>1btn-com1</button>
        <button onClick={()=>this.changePage('/com2')}>1btn-com2</button>
      </>
    )
  }
}
